{% extends "orga/settings/base.html" %}

{% load compress %}
{% load i18n %}
{% load static %}

{% block stylesheets %}
    <link rel="stylesheet" type="text/css" href="{% static "common/css/headers-uncompressed.css" %}" />
{% endblock stylesheets %}

{% block scripts %}
    {% compress js %}
        <script defer src="{% static "vendored/vanilla-picker/vanilla-picker.min.js" %}"></script>
        <script defer src="{% static "orga/js/colorpicker.js" %}"></script>
        <script defer src="{% static "orga/js/eventSettings.js" %}"></script>
        <script defer src="{% static "js/jquery.js" %}"></script>
        <script defer src="{% static "js/jquery.formset.js" %}"></script>
        <script defer src="{% static "cfp/js/animateFormset.js" %}"></script>
    {% endcompress %}
{% endblock scripts %}

{% block extra_title %}{% translate "Settings" %} :: {% endblock extra_title %}

{% block settings_content %}
    <div id="main-title" class="d-md-flex justify-content-between">
        <h2>{% translate "Settings" %}</h2>
        {% include "orga/event/component_link.html" %}
    </div>
    <form method="post" enctype="multipart/form-data">
        {% csrf_token %}

        {% include "orga/includes/tablist.html" %}

        <section role="tabpanel" id="tabpanel-general" aria-labelledby="tab-general" tabindex="0" aria-hidden="false">
            {% include "common/forms/errors.html" %}

            {{ form.name.as_field_group }}
            {{ form.slug.as_field_group }}
            {{ form.date_from.as_field_group }}
            {{ form.date_to.as_field_group }}
            {{ form.email.as_field_group }}
            {{ form.custom_domain.as_field_group }}
            {{ form.meta_noindex.as_field_group }}
            {{ form.imprint_url.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-localisation" aria-labelledby="tab-localisation" tabindex="0" aria-hidden="true">
            {{ form.locale.as_field_group }}
            {{ form.locales.as_field_group }}
            {{ form.content_locales.as_field_group }}
            {{ form.timezone.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-texts" aria-labelledby="tab-texts" tabindex="0" aria-hidden="true">
            {{ form.landing_page_text.as_field_group }}
            {{ form.featured_sessions_text.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-display" aria-labelledby="tab-display" tabindex="0" aria-hidden="true">
            <fieldset>
                <legend id="design">{% translate "Design" %}</legend>
                {{ form.primary_color.as_field_group }}
                {{ form.logo.as_field_group }}
                {{ form.header_image.as_field_group }}
                <div id="csswrap">
                    {{ form.custom_css.as_field_group }}
                    <button class="btn btn-outline-info" type="button" data-toggle="collapse" data-target="#collapseCSSBox" aria-expanded="false" aria-controls="collapseCSSBox">
                        <i class="fa fa-code"></i>
                    </button>
                </div>
                <div class="collapse" id="collapseCSSBox">
                    {{ form.custom_css_text.as_field_group }}
                </div>
                <div {% if request.event.primary_color %}style="--color: {{ request.event.primary_color }}"{% endif %} class="colorpicker-update">
                    {{ form.header_pattern.as_field_group }}
                </div>
            </fieldset>
            <fieldset>
                <legend id="schedule">{% translate "Schedule" %}</legend>
                {{ form.show_schedule.as_field_group }}
                {{ form.schedule.as_field_group }}
                {{ form.show_featured.as_field_group }}
                {{ form.use_feedback.as_field_group }}
                {{ form.export_html_on_release.as_field_group }}
                {{ form.html_export_url.as_field_group }}
				{{ form.ticket_link.as_field_group }}
                {{ form.video_link.as_field_group }}
            </fieldset>
            <fieldset>
                <legend id="other-settings">{% translate "Other settings" %}</legend>

                <div class="form-group hide-optional">
                    <label class="col-md-3 control-label">
                        {% translate "Header links" %}<br>
                        <span class="optional">{% translate "Optional" %}</span>
                    </label>
                    <div class="col-md-9">
                        <p class="mt-1 mb-2 text-muted">
                            {% blocktranslate trimmed %}
                                These links will be shown at the top of all your schedule-related pages, e.g.
                                the schedule itself, speaker pages, session pages, etc.
                                You could for example link to your home page, your registration page, or your
                                livestream here.
                            {% endblocktranslate %}
                        </p>
                        {% include "orga/includes/event_links_formset.html" with formset=header_links_formset %}
                    </div>
                </div>

                <div class="form-group hide-optional">
                    <label class="col-md-3 control-label">
                        {% translate "Footer links" %}<br>
                        <span class="optional">{% translate "Optional" %}</span>
                    </label>
                    <div class="col-md-9">
                        <p class="mt-1 mb-2 text-muted">
                            {% blocktranslate trimmed %}
                                These links will be shown in the footer of all your public pages. You could
                                for example link your terms of service, imprint, or privacy policy here.
                            {% endblocktranslate %}
                        </p>
                        {% include "orga/includes/event_links_formset.html" with formset=footer_links_formset %}
                    </div>
                </div>
            </fieldset>
        </section>
        <div class="submit-group panel">
            <span>
                {% if request.user.is_administrator %}
                    <a class="btn btn-outline-danger btn-lg" href="{{ request.event.orga_urls.delete }}">
                        {% translate "Delete event" %}
                    </a>
                {% endif %}
            </span>
            <span>
                <button type="submit" class="btn btn-success btn-lg">
                    <i class="fa fa-check"></i>
                    {{ phrases.base.save }}
                </button>
            </span>
        </div>
    </form>
{% endblock settings_content %}
